#ifndef KCORE_DX_H
#define KCORE_DX_H


#if defined(KCORE_USE_DX8) && defined(KCORE_USE_DX9)
#error "only one version type of dx8 or dx9 can be used"
#elif defined(KCORE_USE_DX8)
#include "KCoreDX8.h"
#elif defined(KCORE_USE_DX9)
#include "KCoreDX9.h"
#else
#error "please define dx version type"
#endif


typedef HRESULT (*KCORE_CREATE_DEVICE_CALLBACK)( KCIDirect3DDevice* pd3dDevice );
typedef void (*KCORE_FRAME_RENDER_CALLBACK)( KCIDirect3DDevice* pd3dDevice );
typedef void (*KCORE_DESTROY_DEVICE_CALLBACK)(KCIDirect3DDevice* pd3dDevice);

#define KSAFE_RELEASE(p) if (p) { p->Release(); p = NULL; }

void KCDXSetCallbackCreateDevice(KCORE_CREATE_DEVICE_CALLBACK cb);
void KCDXSetCallbackFrameRender(KCORE_FRAME_RENDER_CALLBACK cb);
void KCDXSetCallbackDeviceDestroyed(KCORE_DESTROY_DEVICE_CALLBACK cb);

void KCDXInit();
void KCDXCreateWindow(const char *title, int width, int height);
void KCDXCreateDevice();

void KCDXMainLoop();

void KCDX_HR_FAILCHECK(DWORD hr, const char *desc);

#endif
